/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package exemple;

import java.net.InetAddress;
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.List;


/**
 *
 * @author jfdenise
 */
public class ClientRMI {
    

    
    public static List<ProcessusB> getListOfProcessus(String ip) {
        List<ProcessusB> listProcess = null;
        try {
            
            Service obj = (Service) Naming.lookup("//"+ip+"/HelloServer");         
            
          
            //Service obj = (Service) Naming.lookup("//localhost/HelloServer");

            listProcess = obj.getListProcessus();
            /*for (ProcessusB p : listProcess) {
                System.out.println(p.toString());
            }*/
            
        } catch (Exception e) {
            System.out.println("Client exception: " + e.getMessage());
            e.printStackTrace();
        }
        return listProcess;
    }
    
    public static HistoricSystem getSystemInformations(String ip) {
        HistoricSystem hi = null;
        try {
            //Service obj = (Service) Naming.lookup("//"+ip+"/HelloServer");  
            Service obj = (Service) Naming.lookup("//127.0.0.1/HelloServer");
            hi = obj.getSystemInformations();
            System.out.println(hi);
            
        } catch (Exception e) {
            System.out.println("Client exception: " + e.getMessage());
            e.printStackTrace();
        }
        return hi;
    }
}
